package edu.bluebeanforum.controller;

import edu.bluebeanforum.common.AppResult;
import edu.bluebeanforum.exception.ApplicationException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "测试类的接口")
@RestController
public class TestController {
    @ApiOperation("接口1：")
    @RequestMapping("/test")
    public String test(){
        return "欢迎来到蓝豆论坛";
    }
    @ApiOperation("接口2：")
    @GetMapping("/exception")
    public AppResult testException() throws Exception {
        throw new Exception("这是一个Exception异常");
    }
    @ApiOperation("接口3：")
    @GetMapping("/appException")
    public AppResult appException() throws Exception{
        throw  new ApplicationException("这是一个ApplicationException异常");
    }
}
